package lesson2;

//import java.util.Scanner;

public class pereborom {
	    public static void main(String args[])
	    {
	       long startTime = System.currentTimeMillis();
	        int fi = 30;
	        int si = 1000;
	        System.out.println(NOD(fi,si));
	        long timeSpent = System.currentTimeMillis() - startTime;
	        System.out.println("Program - " + timeSpent);
	    }
	    static int NOD(int fi,int si)
	    {
	        int min;
	        int nod = 0;
	        if(fi > si)
	            min = si;
	        else
	            min = fi;
	        for(int count = 1;count <= min;count++)
	        {
	            if(fi % count == 0 && si % count == 0){
	            if(count>nod)
	            nod = count;
	            }
	        }
	        return nod;
	    }
	 }